import { colorStr } from '@/utils/utils';
import { Button, Modal } from 'antd';
import styles from '../index.less';

type Props = {
  ifDelete: string;
  handleCancel: () => void;
  handleSeal: () => void;
  delivery: () => void;
};

const SealModal: React.FC<Props> = ({ ifDelete, handleCancel, handleSeal, delivery }) => {
  return ifDelete !== '3' ? (
    <Modal
      visible={true}
      footer={null}
      closable={false}
      className={styles.modalStyle}
      width={540}
      centered={true}
    >
      <div className={styles.modalContent}>
        <div className={styles.bigText}>
          确认{`${ifDelete === '1' ? '发货' : ifDelete === '5' ? '签收该订单的退货' : '配送'}`}吗？
        </div>
        <div className={styles.smallText}>
          选择确认，将进行{`${ifDelete === '1' ? '发货' : ifDelete === '5' ? '退货签收' : '配送'}`}
          操作。
        </div>
      </div>
      <div className={styles.btns}>
        <Button onClick={handleCancel} className={styles.btnCancel}>
          取消
        </Button>
        <Button
          key="submit"
          type="primary"
          onClick={() => {
            ifDelete === '1' ? delivery() : handleSeal();
          }}
          style={{ backgroundColor: colorStr(8) }}
          className={styles.btnSeal}
        >
          {`${ifDelete === '1' ? '发货' : ifDelete === '5' ? '签收' : '配送'}`}
        </Button>
      </div>
    </Modal>
  ) : (
    <Modal
      visible={true}
      footer={null}
      closable={false}
      className={styles.modalStyle}
      width={540}
      centered={true}
    >
      <div className={styles.modalContent}>
        <div className={styles.bigText}>确定删除吗？</div>
        <div className={styles.smallText}>
          选择确认，将删除当选行订单，并且不可恢复；选择取消，将不进行删除操作。
        </div>
      </div>
      <div className={styles.btns}>
        <Button onClick={handleCancel} className={styles.btnCancel}>
          取消
        </Button>
        <Button
          key="submit"
          type="primary"
          onClick={handleSeal}
          style={{ backgroundColor: colorStr(8) }}
          className={styles.btnSeal}
        >
          删除
        </Button>
      </div>
    </Modal>
  );
};

export default SealModal;
